
(require 'xcscope)

(define-key global-map [(control f3)]  'cscope-set-initial-directory)
(define-key global-map [(control f4)]  'cscope-unset-initial-directory)
(define-key global-map [(control f5)]  'cscope-find-this-symbol)
(define-key global-map [(control f6)]  'cscope-find-global-definition)
(define-key global-map [(control f7)]
  'cscope-find-global-definition-no-prompting)
(define-key global-map [(control f8)]  'cscope-pop-mark)
(define-key global-map [(control f9)]  'cscope-history-forward-line)
(define-key global-map [(control f10)] 'cscope-history-forward-file)
(define-key global-map [(control f11)] 'cscope-history-backward-line)
(define-key global-map [(control f12)] 'cscope-history-backward-file)
(define-key global-map [(meta f9)]  'cscope-display-buffer)
(define-key global-map [(meta f10)] 'cscope-display-buffer-toggle)

;; (add-hook 'shell-mode-hook 'cscope-minor-mode)
;; (add-hook 'c-mode-hook 'cscope-minor-mode)
;; (add-hook 'c++-mode-hook 'cscope-minor-mode)
;; (add-hook 'dired-mode-hook 'cscope-minor-mode)

(defun cscope-setting ()

  ;; close the evil-local-mode
  (evil-local-mode -1)

  (define-key cscope-list-entry-keymap (kbd "k") 'previous-line)
  (define-key cscope-list-entry-keymap (kbd "j") 'next-line)
  (define-key cscope-list-entry-keymap (kbd "K") 'cscope-history-kill-line)
  )

(add-hook 'cscope-list-entry-hook 'cscope-setting)

(provide 'init-cscope)
